/* 鸡兔同笼 */
#include<iostream>
using namespace std;

int main(void)
{
	int legsPerChick = 2;
	int legsPerRabbit = 4;
	constexpr int totalLegs[] = {3, 5, 6, 7, 8, 9, 10, 50, 100};
	constexpr int N = sizeof(totalLegs) / sizeof(totalLegs[0]);

	for (int i = 0; i < N; i++)
	{
		int legs = totalLegs[i];

		int chick = 0;
		int rabbit = 0;

		rabbit = legs / legsPerRabbit;
		int minCnt = 0;
		chick = 0;
		while (rabbit > 0)
		{
			int leftLegs = legs - rabbit * legsPerRabbit;
			chick = leftLegs / legsPerChick;
			leftLegs -= chick * legsPerChick;

			if (leftLegs ==  0)
			{
				minCnt = rabbit + chick;
				break;
			}
			else
			{
				rabbit --;
			}
		}

		rabbit = 0;
		chick = legs / legsPerChick;
		int maxCnt = 0;

		while (chick > 0)
		{
			int leftLegs = legs - chick * legsPerChick;
			rabbit = leftLegs / legsPerRabbit;
			leftLegs -= rabbit * legsPerRabbit;

			if (leftLegs == 0)
			{
				maxCnt = chick + rabbit;
				break;
			}
			else
			{
				chick --;
			}
		}
		
		cout<< "minCnt: " << minCnt << ", maxCnt: " << maxCnt <<endl;

	}
}
